Attribute VB_Name = "modX"
Option Explicit

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
''* Types
'Public Type typMenuItem
'    IconNum     As Long
'    Text        As String
'    bPopupmenu  As Boolean
'    mnuSubMenu  As clsXPMenu
'    '//////////////////////Add
'    st As Long
'    en As Boolean
'    cd As Boolean
'    gn As String
'    gf As Boolean
'    vs As Boolean
'    dd As Boolean
'    '=============
'    x As Long
'    y As Long
'    '=============
'    obj As Object
'    obj_hwnd As Long
'    '//////////////////////
'End Type

''///////////////new menu bar
'Public Type typeMenuBar
' cap As String
' en As Boolean
' vs As Boolean
' obj As clsXPMenu
'End Type

Public Const OfficeColor1 As Long = &HFBE3D1
Public Const OfficeColor2 As Long = &HE3AB84

Public Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const GWL_EXSTYLE = (-20)
'Requires Windows 2000 or later:
Public Const WS_EX_LAYERED = &H80000
Public Declare Function SetLayeredWindowAttributes Lib "USER32" _
    (ByVal hWnd As Long, ByVal crKey As Long, _
    ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Const LWA_COLORKEY = &H1
Public Const LWA_ALPHA = &H2

Public Const ULW_COLORKEY = &H1
Public Const ULW_ALPHA = &H2
Public Const ULW_OPAQUE = &H4

'/////////xxxxxx
Public LevelData(1 To 40, 1 To 30) As Byte

Public Function GetHotKey(ByVal s As String) As String
Dim s1 As String, i As Long
s1 = UCase(s)
s1 = Replace(s1, "&&", "")
i = InStr(1, s1, "&")
If i > 0 Then
 GetHotKey = Mid(s1, i + 1, 1)
End If
End Function

Public Sub UnloadAll()
On Error Resume Next
Dim frm As Form
For Each frm In Forms
 Unload frm
Next frm
End Sub

Public Sub SetLayeredWindow(ByVal hWnd As Long, _
ByVal bIsLayered As Boolean)
    Dim l As Long

    l = GetWindowLong(hWnd, GWL_EXSTYLE)

    If bIsLayered = True Then
        l = l Or WS_EX_LAYERED
    Else
        l = l And Not WS_EX_LAYERED
    End If
    SetWindowLong hWnd, GWL_EXSTYLE, l
    
End Sub

'//////////////////////////////stupid functions

Public Function GetKeyword(ByVal n As Long) As Long 'stupid calc shiTER!!
On Error Resume Next
Dim b(3) As Byte, i As Long
b(0) = Abs(n) Mod 233
b(1) = Abs(n + 23 * b(0)) Mod 237
b(2) = Abs(n + 21 * b(1)) Mod 229
b(3) = Abs(n + 45 * b(2)) Mod 241
b(0) = Abs(n + 19 * b(3)) Mod 246
b(1) = Abs(n + 33 * b(0)) Mod 247
b(2) = Abs(n + 34 * b(1)) Mod 251
b(3) = Abs(n + 28 * b(2)) Mod 253
CopyMemory i, b(0), 4&
GetKeyword = i
End Function

Public Sub lX(n As Long, kw As Long, ByVal n1 As Long)
If GetKeyword(n) <> kw Then Crash
n = n1
kw = GetKeyword(n)
End Sub

Private Sub Crash()
Dim b As Boolean
Debug.Assert pCrash(b)
If Not b Then CopyMemory ByVal ObjPtr(App), 0&, 4
End Sub

Private Function pCrash(b As Boolean) As Boolean
b = True
End Function
